#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0;bool f=0;char ch=getchar();
	while(ch<'0'||ch>'9')f^=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
mt19937 rnd(time(0));
int main(){
	freopen("paint.in","w",stdout);
	int n=1e5,m=5,q=5e4;
	printf("%d %d %d\n",n,m,q);
	for(int i=1;i<=n;i++){
		int val=rnd();
		if(val<0)val=-val;
		val=val%m+1;
		printf("%d ",val);
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			int val=rnd();
			if(val<0)val=-val;
			val=val%10+1;
			printf("%d ",val);
		}puts("");
	}
	while(q--){
		
	}
	return 0;
}

